
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>2.2 搭建Opengl开发环境 · 游戏引擎浅入浅出</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="captainchen">
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-lightbox/css/lightbox.min.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="../3. 绘制简单图形/3. 绘制简单图形.html" />
    
    
    <link rel="prev" href="2.1 Opengl到底是什么.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">目录</li>
        
        
    
        <li class="chapter " data-level="2.1" data-path="../前言.html">
            
                <a href="../前言.html">
            
                    
                    前言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="../1. 游戏引擎框架介绍/1. 游戏引擎框架介绍.html">
            
                <a href="../1. 游戏引擎框架介绍/1. 游戏引擎框架介绍.html">
            
                    
                    1. 游戏引擎框架介绍
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.2.1" data-path="../1. 游戏引擎框架介绍/1.1 暗中观察unity.html">
            
                <a href="../1. 游戏引擎框架介绍/1.1 暗中观察unity.html">
            
                    
                    1.1 暗中观察unity
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2.2" data-path="../1. 游戏引擎框架介绍/1.2 游戏引擎组成.html">
            
                <a href="../1. 游戏引擎框架介绍/1.2 游戏引擎组成.html">
            
                    
                    1.2 游戏引擎组成
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="2. Opengl开发环境搭建.html">
            
                <a href="2. Opengl开发环境搭建.html">
            
                    
                    2. Opengl开发环境搭建
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.3.1" data-path="2.1 Opengl到底是什么.html">
            
                <a href="2.1 Opengl到底是什么.html">
            
                    
                    2.1 Opengl到底是什么
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="2.3.2" data-path="2.2 搭建Opengl开发环境.html">
            
                <a href="2.2 搭建Opengl开发环境.html">
            
                    
                    2.2 搭建Opengl开发环境
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="../3. 绘制简单图形/3. 绘制简单图形.html">
            
                <a href="../3. 绘制简单图形/3. 绘制简单图形.html">
            
                    
                    3. 绘制简单图形
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.4.1" data-path="../3. 绘制简单图形/3.1 画个三角形.html">
            
                <a href="../3. 绘制简单图形/3.1 画个三角形.html">
            
                    
                    3.1 画个三角形
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4.2" data-path="../3. 绘制简单图形/3.2 画个正方形.html">
            
                <a href="../3. 绘制简单图形/3.2 画个正方形.html">
            
                    
                    3.2 画个正方形
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4.3" data-path="../3. 绘制简单图形/3.3 画个立方体.html">
            
                <a href="../3. 绘制简单图形/3.3 画个立方体.html">
            
                    
                    3.3 画个立方体
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="../4. 着色器/4. 着色器.html">
            
                <a href="../4. 着色器/4. 着色器.html">
            
                    
                    4. 着色器
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.5.1" data-path="../4. 着色器/4.1 着色器是什么.html">
            
                <a href="../4. 着色器/4.1 着色器是什么.html">
            
                    
                    4.1 着色器是什么
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.5.2" data-path="../4. 着色器/4.2 Unity Shader和OpenGL Shader.html">
            
                <a href="../4. 着色器/4.2 Unity Shader和OpenGL Shader.html">
            
                    
                    4.2 Unity Shader和OpenGL Shader
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.5.3" data-path="../4. 着色器/4.3 顶点着色器.html">
            
                <a href="../4. 着色器/4.3 顶点着色器.html">
            
                    
                    4.3 顶点着色器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.5.4" data-path="../4. 着色器/4.4 片段着色器.html">
            
                <a href="../4. 着色器/4.4 片段着色器.html">
            
                    
                    4.4 片段着色器
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="../5. 绘制贴图/5. 绘制贴图.html">
            
                <a href="../5. 绘制贴图/5. 绘制贴图.html">
            
                    
                    5. 绘制贴图
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.6.1" data-path="../5. 绘制贴图/5.1 颜色和贴图.html">
            
                <a href="../5. 绘制贴图/5.1 颜色和贴图.html">
            
                    
                    5.1 颜色和贴图
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.2" data-path="../5. 绘制贴图/5.2 贴图文件介绍.html">
            
                <a href="../5. 绘制贴图/5.2 贴图文件介绍.html">
            
                    
                    5.2 贴图文件介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.3" data-path="../5. 绘制贴图/5.3 CPU与GPU的通信方式.html">
            
                <a href="../5. 绘制贴图/5.3 CPU与GPU的通信方式.html">
            
                    
                    5.3 CPU与GPU的通信方式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.4" data-path="../5. 绘制贴图/5.4 使用stb_image解析图片.html">
            
                <a href="../5. 绘制贴图/5.4 使用stb_image解析图片.html">
            
                    
                    5.4 使用stb_image解析图片
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.5" data-path="../5. 绘制贴图/5.5 绘制带贴图的立方体盒子.html">
            
                <a href="../5. 绘制贴图/5.5 绘制带贴图的立方体盒子.html">
            
                    
                    5.5 绘制带贴图的立方体盒子
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.6" data-path="../5. 绘制贴图/5.6 压缩纹理.html">
            
                <a href="../5. 绘制贴图/5.6 压缩纹理.html">
            
                    
                    5.6 压缩纹理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.7" data-path="../5. 绘制贴图/5.7 图片压缩工具.html">
            
                <a href="../5. 绘制贴图/5.7 图片压缩工具.html">
            
                    
                    5.7 图片压缩工具
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6.8" data-path="../5. 绘制贴图/5.8 使用压缩纹理.html">
            
                <a href="../5. 绘制贴图/5.8 使用压缩纹理.html">
            
                    
                    5.8 使用压缩纹理
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.7" data-path="../6. 索引与缓冲区对象/6. 缓冲区对象.html">
            
                <a href="../6. 索引与缓冲区对象/6. 缓冲区对象.html">
            
                    
                    6. 缓冲区对象
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.7.1" data-path="../6. 索引与缓冲区对象/6.1 顶点索引.html">
            
                <a href="../6. 索引与缓冲区对象/6.1 顶点索引.html">
            
                    
                    6.1 顶点索引
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.7.2" data-path="../6. 索引与缓冲区对象/6.2 缓冲区对象.html">
            
                <a href="../6. 索引与缓冲区对象/6.2 缓冲区对象.html">
            
                    
                    6.2 缓冲区对象
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.8" data-path="../7. Mesh和材质/7. Mesh和材质.html">
            
                <a href="../7. Mesh和材质/7. Mesh和材质.html">
            
                    
                    7. Mesh和材质
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.8.1" data-path="../7. Mesh和材质/7.1 导出Mesh文件.html">
            
                <a href="../7. Mesh和材质/7.1 导出Mesh文件.html">
            
                    
                    7.1 导出Mesh文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.8.2" data-path="../7. Mesh和材质/7.2 使用Mesh文件.html">
            
                <a href="../7. Mesh和材质/7.2 使用Mesh文件.html">
            
                    
                    7.2 使用Mesh文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.8.3" data-path="../7. Mesh和材质/7.3 Shader文件创建与使用.html">
            
                <a href="../7. Mesh和材质/7.3 Shader文件创建与使用.html">
            
                    
                    7.3 Shader文件创建与使用
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >2.2 搭建Opengl开发环境</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <html><head></head><body><div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><ul><li><span class="title-icon "></span><a href="#22-&#x642D;&#x5EFA;opengl&#x5F00;&#x53D1;&#x73AF;&#x5883;"><b></b>2.2 &#x642D;&#x5EFA;Opengl&#x5F00;&#x53D1;&#x73AF;&#x5883;</a></li><ul><li><span class="title-icon "></span><a href="#1&#x4E0B;&#x8F7D;glfw"><b></b>1.&#x4E0B;&#x8F7D;glfw</a></li><li><span class="title-icon "></span><a href="#2&#x914D;&#x7F6E;clion&#x9879;&#x76EE;"><b></b>2.&#x914D;&#x7F6E;CLion&#x9879;&#x76EE;</a></li><li><span class="title-icon "></span><a href="#3&#x8FD9;&#x5C31;&#x662F;opengl"><b></b>3.&#x8FD9;&#x5C31;&#x662F;OpenGL</a></li><li><span class="title-icon "></span><a href="#4&#x793A;&#x4F8B;&#x4E0B;&#x8F7D;"><b></b>4.&#x793A;&#x4F8B;&#x4E0B;&#x8F7D;</a></li><li><span class="title-icon "></span><a href="#5&#x53C2;&#x8003;&#x6587;&#x6863;"><b></b>5.&#x53C2;&#x8003;&#x6587;&#x6863;</a></li></ul></ul></ul></div><h2 id="22-&#x642D;&#x5EFA;opengl&#x5F00;&#x53D1;&#x73AF;&#x5883;"><a name="22-&#x642D;&#x5EFA;opengl&#x5F00;&#x53D1;&#x73AF;&#x5883;" class="anchor-navigation-ex-anchor" href="#22-&#x642D;&#x5EFA;opengl&#x5F00;&#x53D1;&#x73AF;&#x5883;"><i class="fa fa-link" aria-hidden="true"></i></a>2.2 &#x642D;&#x5EFA;Opengl&#x5F00;&#x53D1;&#x73AF;&#x5883;</h2>
<p>&#x5982;&#x679C;&#x8981;&#x81EA;&#x5DF1;&#x4E00;&#x884C;&#x4E00;&#x884C;&#x4EE3;&#x7801;&#x53BB;&#x521B;&#x5EFA;opengl&#x73AF;&#x5883;&#xFF0C;&#x6BD4;&#x8F83;&#x9EBB;&#x70E6;&#xFF0C;opengl&#x5B98;&#x7F51;&#x63A8;&#x8350;&#x4E86;&#x5F88;&#x591A;&#x5F00;&#x6E90;&#x5E93;&#xFF0C;&#x51E0;&#x884C;&#x4EE3;&#x7801;&#x5C31;&#x53EF;&#x4EE5;&#x521B;&#x5EFA;opengl&#x73AF;&#x5883;&#x3002;</p>
<p>&#x6211;&#x8FD9;&#x91CC;&#x9009;&#x62E9; glfw &#x3002;</p>
<h3 id="1&#x4E0B;&#x8F7D;glfw"><a name="1&#x4E0B;&#x8F7D;glfw" class="anchor-navigation-ex-anchor" href="#1&#x4E0B;&#x8F7D;glfw"><i class="fa fa-link" aria-hidden="true"></i></a>1.&#x4E0B;&#x8F7D;glfw</h3>
<p>glfw&#x7684;&#x4E0B;&#x8F7D;&#x5730;&#x5740; <code>https://www.glfw.org/download.html</code></p>
<p>&#x5728;download &#x9875;&#x9762;&#xFF0C;&#x9009;&#x62E9; &#x5BF9;&#x5E94;&#x7CFB;&#x7EDF;&#x6587;&#x4EF6; &#x4E0B;&#x8F7D;&#x3002;</p>
<p><a href="../../imgs/opengl_dev_env/dev_env_configure/download_glfw.png" data-lightbox="c0c96a0f-6aa9-449d-b67d-6462a9c1b864" data-title="download glfw"><img src="../../imgs/opengl_dev_env/dev_env_configure/download_glfw.png" alt="download glfw"></a></p>
<h3 id="2&#x914D;&#x7F6E;clion&#x9879;&#x76EE;"><a name="2&#x914D;&#x7F6E;clion&#x9879;&#x76EE;" class="anchor-navigation-ex-anchor" href="#2&#x914D;&#x7F6E;clion&#x9879;&#x76EE;"><i class="fa fa-link" aria-hidden="true"></i></a>2.&#x914D;&#x7F6E;CLion&#x9879;&#x76EE;</h3>
<p>&#x9996;&#x5148;&#x5B89;&#x88C5;&#x597D;Mingw+CLion&#xFF0C;&#x5148;&#x5B89;&#x88C5;Mingw&#xFF0C;&#x518D;&#x5B89;&#x88C5;CLion&#x6253;&#x5F00;&#x540E;&#x4F1A;&#x81EA;&#x52A8;&#x8BC6;&#x522B;&#x3002;</p>
<pre><code>Mingw&#x4E0B;&#x8F7D;&#x5730;&#x5740;&#xFF1A;http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/installer/mingw-w64-install.exe/download
CLion&#x4E0B;&#x8F7D;&#x5730;&#x5740;&#xFF1B;https://www.jetbrains.com/clion/
</code></pre><p>&#x7528;CLion&#x65B0;&#x5EFA;&#x4E00;&#x4E2A;<code>C++</code>&#x9879;&#x76EE;&#xFF0C;&#x7136;&#x540E;&#x590D;&#x5236;&#x4E0B;&#x9762;&#x7684;&#x4EE3;&#x7801;&#x5230; <code>main.cpp</code> &#x4E2D;&#x3002;</p>
<pre><code class="lang-c++"><span class="hljs-comment">//main.cpp</span>
<span class="hljs-meta">#<span class="hljs-meta-keyword">include</span> <span class="hljs-meta-string">&lt;GLFW/glfw3.h&gt;</span></span>

<span class="hljs-function"><span class="hljs-keyword">int</span> <span class="hljs-title">main</span><span class="hljs-params">(<span class="hljs-keyword">void</span>)</span>
</span>{
    GLFWwindow* window;

    <span class="hljs-comment">/* &#x521D;&#x59CB;&#x5316;glfw */</span>
    <span class="hljs-keyword">if</span> (!glfwInit())
        <span class="hljs-keyword">return</span> <span class="hljs-number">-1</span>;

    <span class="hljs-comment">/* &#x521B;&#x5EFA;&#x4E00;&#x4E2A;Window &#x548C; OpenGL&#x4E0A;&#x4E0B;&#x6587; */</span>
    window = glfwCreateWindow(<span class="hljs-number">640</span>, <span class="hljs-number">480</span>, <span class="hljs-string">&quot;Hello World&quot;</span>, <span class="hljs-literal">NULL</span>, <span class="hljs-literal">NULL</span>);
    <span class="hljs-keyword">if</span> (!window)
    {
        <span class="hljs-comment">//&#x521B;&#x5EFA;&#x5931;&#x8D25;&#x5C31;&#x9000;&#x51FA;</span>
        glfwTerminate();
        <span class="hljs-keyword">return</span> <span class="hljs-number">-1</span>;
    }

    <span class="hljs-comment">/* &#x6FC0;&#x6D3B;&#x4E0A;&#x9762;&#x521B;&#x5EFA;&#x7684;OpenGL&#x4E0A;&#x4E0B;&#x6587; */</span>
    glfwMakeContextCurrent(window);

    <span class="hljs-comment">/* &#x8FDB;&#x5165;&#x6E38;&#x620F;&#x5F15;&#x64CE;&#x4E3B;&#x5FAA;&#x73AF; */</span>
    <span class="hljs-keyword">while</span> (!should_close(window))
    {
        <span class="hljs-comment">/* Render here */</span>
        glClear(GL_COLOR_BUFFER_BIT);

        <span class="hljs-comment">/* Swap front and back buffers */</span>
        glfwSwapBuffers(window);

        <span class="hljs-comment">/* &#x5904;&#x7406;&#x9F20;&#x6807; &#x952E;&#x76D8;&#x4E8B;&#x4EF6; */</span>
        glfwPollEvents();
    }

    glfwTerminate();
    <span class="hljs-keyword">return</span> <span class="hljs-number">0</span>;
}
</code></pre>
<p>&#x5982;&#x4E0B;&#x56FE;</p>
<p><a href="../../imgs/opengl_dev_env/dev_env_configure/glfw_empty_window_main_cpp.png" data-lightbox="45c5f517-abce-4eb8-b00e-f459175e13eb" data-title=""><img src="../../imgs/opengl_dev_env/dev_env_configure/glfw_empty_window_main_cpp.png" alt=""></a></p>
<p>&#x8FD9;&#x4E2A;&#x65F6;&#x5019;&#x7F16;&#x8BD1;&#x4E0D;&#x901A;&#x8FC7;&#x7684;&#xFF0C;&#x8FD8;&#x6CA1;&#x6709;&#x6DFB;&#x52A0; glfw lib&#x5E93;&#x548C;&#x5934;&#x6587;&#x4EF6;&#x5F15;&#x7528;&#x3002;</p>
<p>CLion&#x4E2D;&#x7684;&#x4F9D;&#x8D56;&#x5E93;&#x5168;&#x90E8;&#x5728; <code>CMakeLists.txt</code> &#x4E2D;&#x8FDB;&#x884C;&#x914D;&#x7F6E;&#x3002;</p>
<p>&#x4FEE;&#x6539;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre><code class="lang-cmake"><span class="hljs-comment">#CMakeLists.txt</span>
<span class="hljs-keyword">cmake_minimum_required</span>(VERSION <span class="hljs-number">3.17</span>)
<span class="hljs-keyword">project</span>(untitled)

<span class="hljs-keyword">set</span>(CMAKE_CXX_STANDARD <span class="hljs-number">17</span>)

<span class="hljs-comment">#&#x5934;&#x6587;&#x4EF6;&#x76EE;&#x5F55;</span>
<span class="hljs-keyword">include_directories</span>(<span class="hljs-string">&quot;glfw-3.3.3.bin.WIN64/include&quot;</span>)

<span class="hljs-comment">#&#x94FE;&#x63A5;&#x6587;&#x4EF6;&#x76EE;&#x5F55;</span>
<span class="hljs-keyword">link_directories</span>(<span class="hljs-string">&quot;glfw-3.3.3.bin.WIN64/lib-static-ucrt&quot;</span>)

<span class="hljs-comment">#&#x94FE;&#x63A5;&#x5E93;</span>
<span class="hljs-keyword">link_libraries</span>(opengl32 glfw3dll)

<span class="hljs-comment">#&#x6E90;&#x4EE3;&#x7801;&#x6587;&#x4EF6;</span>
<span class="hljs-keyword">add_executable</span>(untitled main.cpp)
</code></pre>
<p>&#x5982;&#x4E0B;&#x56FE;</p>
<p><a href="../../imgs/opengl_dev_env/dev_env_configure/glfw_empty_window_cmakelist.png" data-lightbox="dd35d795-5497-4ec5-ae21-02fbd46ceddd" data-title=""><img src="../../imgs/opengl_dev_env/dev_env_configure/glfw_empty_window_cmakelist.png" alt=""></a></p>
<p>&#x8FD9;&#x4E2A;&#x65F6;&#x5019;&#x53EF;&#x4EE5;&#x7F16;&#x8BD1;&#x901A;&#x8FC7;&#x4E86;&#x3002;&#x4F46;&#x662F;&#x8FD0;&#x884C;&#x4E0D;&#x4E86;&#xFF0C;&#x56E0;&#x4E3A;&#x7F3A;&#x5931;dll&#x6587;&#x4EF6;&#x3002;</p>
<p>&#x62F7;&#x8D1D; <code>glfw-3.3.3.bin.WIN64\lib-static-ucrt\glfw3.dll</code> &#x5230; <code>cmake-build-debug</code> &#x76EE;&#x5F55;&#xFF0C;&#x5982;&#x4E0B;&#x56FE;&#xFF1A;</p>
<p><a href="../../imgs/opengl_dev_env/dev_env_configure/copy_glfw3_dll_to_exe_dir.png" data-lightbox="c33f0d70-6bf6-4b4d-8dbd-1577790ed76f" data-title=""><img src="../../imgs/opengl_dev_env/dev_env_configure/copy_glfw3_dll_to_exe_dir.png" alt=""></a></p>
<p>&#x8FD0;&#x884C;&#xFF0C;&#x5F97;&#x5230;&#x4E00;&#x4E2A;&#x7A7A;&#x7684;OpenGL&#x7A97;&#x53E3;(Unity&#x84DD;)&#x3002;</p>
<p><a href="../../imgs/opengl_dev_env/dev_env_configure/glfw_empty_window_run.png" data-lightbox="43650105-184b-4914-b811-6acc9473a58c" data-title=""><img src="../../imgs/opengl_dev_env/dev_env_configure/glfw_empty_window_run.png" alt=""></a></p>
<h3 id="3&#x8FD9;&#x5C31;&#x662F;opengl"><a name="3&#x8FD9;&#x5C31;&#x662F;opengl" class="anchor-navigation-ex-anchor" href="#3&#x8FD9;&#x5C31;&#x662F;opengl"><i class="fa fa-link" aria-hidden="true"></i></a>3.&#x8FD9;&#x5C31;&#x662F;OpenGL</h3>
<p>&#x4E0A;&#x9762;&#x5F97;&#x5230;&#x7684;&#x9ED1;&#x7A97;&#x53E3;&#xFF0C;&#x5C31;&#x662F;OpenGL&#x7684; <code>Hello World&#xFF01;</code>&#xFF0C;&#x5728;&#x8FD9;&#x4E0A;&#x9762;&#x6162;&#x6162;&#x8FDB;&#x884C;&#x6269;&#x5C55;&#xFF0C;&#x5C31;&#x8FDB;&#x5165;&#x5230;&#x66F4;&#x7EDA;&#x4E3D;&#x7684;&#x6E38;&#x620F;&#x4E16;&#x754C;&#x3002;</p>
<p>&#x4ED4;&#x7EC6;&#x89C2;&#x5BDF;&#x4EE3;&#x7801;&#xFF0C;&#x7406;&#x89E3;OpenGL&#x7684;&#x5DE5;&#x4F5C;&#x6D41;&#x7A0B;&#x3002;</p>
<pre><code class="lang-flow">create_window_context=&gt;start: &#x521B;&#x5EFA;Window &#x4E0A;&#x4E0B;&#x6587;
make_current_window_context=&gt;inputoutput: &#x7ED1;&#x5B9A;Window &#x4E0A;&#x4E0B;&#x6587;
main_loop=&gt;inputoutput: &#x8FDB;&#x5165;&#x4E3B;&#x5FAA;&#x73AF;
    should_close=&gt;condition: &#x662F;&#x5426;&#x9000;&#x51FA;&#x5FAA;&#x73AF;
    render=&gt;inputoutput: &#x6E32;&#x67D3;
    swapbuffer=&gt;inputoutput: &#x4EA4;&#x6362;&#x7F13;&#x51B2;&#x533A;
    pollevent=&gt;inputoutput: &#x5904;&#x7406;IO
end=&gt;end: &#x7ED3;&#x675F;

create_window_context-&gt;make_current_window_context-&gt;main_loop-&gt;should_close

should_close(yes)-&gt;end

should_close(no)-&gt;render(right)-&gt;swapbuffer(right)-&gt;pollevent(right)-&gt;should_close
</code></pre>
<h3 id="4&#x793A;&#x4F8B;&#x4E0B;&#x8F7D;"><a name="4&#x793A;&#x4F8B;&#x4E0B;&#x8F7D;" class="anchor-navigation-ex-anchor" href="#4&#x793A;&#x4F8B;&#x4E0B;&#x8F7D;"><i class="fa fa-link" aria-hidden="true"></i></a>4.&#x793A;&#x4F8B;&#x4E0B;&#x8F7D;</h3>
<p>CLion&#x9879;&#x76EE;&#x6587;&#x4EF6;&#x5B58;&#x653E;&#x5728; <code>samples\glfw_empty_window\untitled</code> &#x76EE;&#x5F55;&#x4E2D;&#xFF0C;&#x76F4;&#x63A5;&#x7528;CLion&#x6253;&#x5F00;&#x5373;&#x53EF;&#x3002;</p>
<h3 id="5&#x53C2;&#x8003;&#x6587;&#x6863;"><a name="5&#x53C2;&#x8003;&#x6587;&#x6863;" class="anchor-navigation-ex-anchor" href="#5&#x53C2;&#x8003;&#x6587;&#x6863;"><i class="fa fa-link" aria-hidden="true"></i></a>5.&#x53C2;&#x8003;&#x6587;&#x6863;</h3>
<p>glfw&#x5B98;&#x65B9;&#x6559;&#x7A0B;</p>
<pre><code>https://www.glfw.org/documentation.html 
</code></pre><footer class="page-footer"><span class="copyright">Copyright &#xA9; captainchen all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">File Modify: 
2021-03-26 11:20:28
</span></footer></body></html>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="2.1 Opengl到底是什么.html" class="navigation navigation-prev " aria-label="Previous page: 2.1 Opengl到底是什么">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="../3. 绘制简单图形/3. 绘制简单图形.html" class="navigation navigation-next " aria-label="Next page: 3. 绘制简单图形">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"2.2 搭建Opengl开发环境","level":"2.3.2","depth":2,"next":{"title":"3. 绘制简单图形","level":"2.4","depth":1,"path":"pages/3. 绘制简单图形/3. 绘制简单图形.md","ref":"pages/3. 绘制简单图形/3. 绘制简单图形.md","articles":[{"title":"3.1 画个三角形","level":"2.4.1","depth":2,"path":"pages/3. 绘制简单图形/3.1 画个三角形.md","ref":"pages/3. 绘制简单图形/3.1 画个三角形.md","articles":[]},{"title":"3.2 画个正方形","level":"2.4.2","depth":2,"path":"pages/3. 绘制简单图形/3.2 画个正方形.md","ref":"pages/3. 绘制简单图形/3.2 画个正方形.md","articles":[]},{"title":"3.3 画个立方体","level":"2.4.3","depth":2,"path":"pages/3. 绘制简单图形/3.3 画个立方体.md","ref":"pages/3. 绘制简单图形/3.3 画个立方体.md","articles":[]}]},"previous":{"title":"2.1 Opengl到底是什么","level":"2.3.1","depth":2,"path":"pages/2. Opengl开发环境搭建/2.1 Opengl到底是什么.md","ref":"pages/2. Opengl开发环境搭建/2.1 Opengl到底是什么.md","articles":[]},"dir":"ltr"},"config":{"plugins":["expandable-chapters","tbfed-pagefooter","splitter","lightbox","anchor-navigation-ex","search-pro","livereload"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"Copyright &copy captainchen","modify_format":"YYYY-MM-DD HH:mm:ss"},"livereload":{},"splitter":{},"search-pro":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"anchor-navigation-ex":{"associatedWithSummary":true,"float":{"floatIcon":"fa fa-navicon","level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"mode":"float","multipleH1":true,"pageTop":{"level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"printLog":false,"showGoTop":false,"showLevel":false},"lightbox":{"jquery":true,"sameUuid":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"expandable-chapters":{}},"theme":"default","author":"captainchen","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"游戏引擎浅入浅出","gitbook":"*"},"file":{"path":"pages/2. Opengl开发环境搭建/2.2 搭建Opengl开发环境.md","mtime":"2021-03-26T03:20:28.693Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2021-04-30T15:25:09.576Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lightbox/js/lightbox.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

